<%@page import="javafx.scene.control.Alert"%>
<%@page import="cn.sendto.model.ScoreEntity"%>
<%@page import="java.util.List"%>
<%@page import="cn.sendto.mapper.ScoreMapper"%>
<%@page import="cn.sendto.mapper.IRowMapper"%>
<%@page import="cn.sendto.dbhelper.DBHelper"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@include file="getSession.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<style type="text/css">
			html,body{
				width: 100%;
				height: 100%;
				background-color: #DDDDDD;
			}
			.con{
				width: 95%;
				margin: 0 auto;
				border: 1px solid darkgrey;
				margin-top:3%;
			}
			.title{
				height: 30px;
				border-bottom: 1px dashed darkgray;
			}
			.title li{
				float: left;
				width: 14%;
				line-height: 30px;
				height: 30px;
				text-align: center;
				overflow: hidden;
			}
			
			a:hover{
				left: 1px;
				top: 1px;
				position: relative;
				color: blue;
				text-shadow:  #000000;
				color: royalblue;
			}
			ul:last-child{
				border-bottom: none;
			}
			ul:first-child{
			   font-weight: bold;
			   background-color: #CCC;
			}
		</style>
		<%
			if(request.getAttribute("message")!=null){
			%>
				<script type="text/javascript">
					alert('<%=request.getAttribute("message")%>');
				</script>
			<% 
			}
			%>
<body>
	<h4 style="text-align: center; margin-top: 3%;font-size:30px;">成绩信息列表</h4>
		<div class="con">
			<ul class="title">
				<li>序号</li>
				<li>姓名</li>				
				<li>科目</li>
				<li>成绩</li>
				<li>修改</li>
				<li>删除</li>
			</ul>
			
			<%
			request.setCharacterEncoding("utf-8");
			String id = request.getParameter("id");
			DBHelper helper = new DBHelper();
			IRowMapper mapper = new ScoreMapper();
			String sql = "select scoreinfo.*,studentinfo.studentname,courseinfo.coursename from scoreinfo,studentinfo,courseinfo where studentinfo.studentid=scoreinfo.studentid and courseinfo.courseid=scoreinfo.courseid and scoreinfo.studentid=?";
			List<ScoreEntity> list = helper.executeQuery(sql, mapper, id);
				for(int i=0;i<list.size();i++){		
			%>
				<ul class="title">
				<li><%=i+1 %></li>
				<li><%=list.get(i).getStudentName() %></li>
				<li><%=list.get(i).getCourseName() %></li>
				<li><%=list.get(i).getScore() %></li>
				<li><a href="modifyscore.jsp?id=<%=list.get(i).getScoreId()%>">修改</a></li>
				<li><a href="descore.jsp?id=<%=list.get(i).getScoreId()%>">删除</a></li>
			</ul>
			<%
				}
				helper.close();
			%>
			
</body>
</html>